package com.srwl.mytx.domain;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Transient;

import java.util.Date;

@Entity
public class ConversationData implements Comparable<ConversationData> {
    @Transient
    public static final int DEFAULT_POSITION = 1000;
    @Id
    private String cId;
    private int unReadCount;
    private int type;
    private Date updated;
    private int position = DEFAULT_POSITION;

    @Generated(hash = 80223150)
    public ConversationData(String cId, int unReadCount, int type, Date updated,
            int position) {
        this.cId = cId;
        this.unReadCount = unReadCount;
        this.type = type;
        this.updated = updated;
        this.position = position;
    }

    public ConversationData(String cId, int unReadCount, int type) {
        this.cId = cId;
        this.unReadCount = unReadCount;
        this.type = type;
    }

    @Generated(hash = 1831948162)
    public ConversationData() {
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getCId() {
        return this.cId;
    }

    public void setCId(String cId) {
        this.cId = cId;
    }

    public int getUnReadCount() {
        return this.unReadCount;
    }

    public void setUnReadCount(int unReadCount) {
        this.unReadCount = unReadCount;
    }

    public int getPosition() {
        return position;
    }

    public void setPosition(int position) {
        this.position = position;
    }

    @Override
    public int compareTo(ConversationData o) {
        return position - o.getPosition();
    }

    public Date getUpdated() {
        return this.updated;
    }

    public void setUpdated(Date updated) {
        this.updated = updated;
    }


}
